home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DIAGTOOL / X10XA2.ZIP;1 / JOYSTICK.CMD < prev    next >
Encoding:
Text File  |  1994-08-14  |  3.2 KB  |  78 lines

  1.  
  2. # * * * * * * * * * * *   SHAREWARE VERSION   * * * * * * * * * * * * * * * *
  3. #
  4. # IF/ELSE/ENDIF, VARIABLES, LOGICAL-BOOLEAN-ARITHMETIC LOGIC HAS BEEN
  5. # DISABLED FROM THE SHAREWARE VERSION. YOU MUST REGISTER THIS SOFTWARE
  6. # TO HAVE THESE FEATURES ACTIVATED.
  7. #
  8. # IN OTHER WORDS - THIS DEMO IS NOT GOING TO WORK!!!
  9. #
  10. # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  11.  
  12. pause
  13.  
  14. #============================================================================
  15. #
  16. #       INPORT Demo Program for XA 
  17. #
  18. #       This command file shows you how to react to input 
  19. #       from the Game Adapter (Joystick Port). 
  20. #       NOTE: Certain functions require Registered version XA 2.x 
  21. #
  22. #       The current switch status of the joystick may be obtained by 
  23. #       reading in the data from port address 201H (hexadecimal).  This 
  24. #       status is then stored in the variable "GAME".
  25. #               GAME = INPORT 201H
  26. #
  27. #       The status of Button A is located in Bit 5 of GAME. If the bit is
  28. #       a '0', then the button is currently pressed. Otherwise, if the bit
  29. #       is '1', then button is released. The status of Button B is located 
  30. #       in Bit 4 of GAME. To determine the individual state of each button,
  31. #       each bit must be "masked", or isolated. A mask of 32 (Hex 20) is 
  32. #       applied (bit-wise AND, the "&" operator) for Button A. A mask of
  33. #       16 (Hex 10) is applied for Button B.
  34. #
  35. #       To reduce the number of CP-290 transmissions, another variable
  36. #       "MODULE" is assigned a value of the current state of the controlled
  37. #       module. This will prevent redundant transmissions.
  38. #
  39. #       In order to make this loop as efficient as possible, the statement
  40. #       "DISPLAY OFF" is used. Note that this file is in fact EXECUTING...
  41. #
  42. #
  43.  
  44. MODULE = OFF                         # Intialize state to Off
  45. DISPLAY OFF                          # Turn display off to speed execution
  46.  
  47.  
  48.  
  49. :LOOP                                # This is the beginning of the loop
  50. GAME = INPORT 201H                   # Read the joystick port
  51.  
  52. IF !(GAME & 20H)                     # Check Button A
  53.   IF (MODULE == OFF)                 # If module is currently Off...
  54.     DISPLAY ON                       # (turn display on so we can see cmd)
  55.     c2 on fast                       # ...Turn module On
  56.     DISPLAY OFF
  57.     MODULE = ON                      # ...update status of module to On
  58.     # DOS c:\sblaster\vplay c:\sblaster\yr.voc    # Make SoundBlaster talk
  59.   ENDIF
  60. ENDIF
  61.  
  62. # Check Button B
  63. IF !(GAME & 10H)                     # Check Button B
  64.   IF (MODULE == ON)                  # If module is currently On...
  65.     DISPLAY ON                       # (turn display on so we can see cmd)
  66.     C2 off fast                      # ...Turn module Off
  67.     DISPLAY OFF
  68.     MODULE = OFF                     # ...update its status too
  69.     # DOS c:\sblaster\vplay c:\sblaster\witch.voc
  70.   ENDIF
  71. ENDIF
  72.  
  73. GOTO LOOP                            # Keep repeating loop until <ESC> pressed.
  74.  
  75. :EXIT                                # Special label to search for when <ESC>.
  76. DISPLAY ON
  77. C2 OFF                               # Put module back into a known state.
  78.